%{
CIS520 Final Project
Plot of # of examples of each class in train set
%}

clear; close all; clc; 

load ../data/music_dataset.mat
addpath 'CV/' 'DT/' 'Lyrics_Kernel/' 'SVM/libsvm/'

[Xt_lyrics] = make_lyrics_sparse(train, vocab);
[Xq_lyrics] = make_lyrics_sparse(quiz, vocab);

Yt = zeros(numel(train), 1);
for i=1:numel(train)
    Yt(i) = genre_class(train(i).genre);
end

Xt_audio = make_audio(train);
Xq_audio = make_audio(quiz);

%% Plot

tlc = bsxfun(@eq,Yt,1:10);
train_class_counts = sum(tlc);

figure(1);
set(gcf,'color','w');
set(gca,'fontsize',18);

hold on;
grid on;

%cell array of colors for classes
colors = cell(10,1);
colors{1} = 'r'; colors{2} = 'g'; colors{3} = 'b';
colors{4} = 'y'; colors{5} = 'c'; colors{6} = 'm';
colors{7} = 'k'; colors{8} = [0.5451 0.2706 0.0745];
colors{9} = [1, .549 0]; colors{10} = [0, .392, 0];

for i=1:10
    bar(i,train_class_counts(i),'facecolor',colors{i});
end
set(gca,'xtick',1:10);
ylabel('Number of Occurances');
title('Number of Examples Per Class in Training Set');
legend('1: Punk', '2: Soul & Reggae', '3: Metal', '4: Folk', ...
    '5: Classic Pop and Rock', '6: Jazz and Blues', '7: Pop', ...
    '8: Dance and Electronica', '9: Hip-Hop', '10: Classical');







